package org.hook.showcase.pattern.iterator.impl;

import org.hook.showcase.pattern.iterator.Iterator;
import org.hook.showcase.pattern.iterator.Menu;

public class Waitress {
	private Menu dinerMenu;

	public Waitress(Menu dinerMenu) {
		this.dinerMenu = dinerMenu;
	}

	public void printMenu() {
		System.out.println("--- MENU ---");
		printMenu(this.dinerMenu.createIterator());
	}

	public void printMenu(Iterator iterator) {
		while (iterator.hasNext()) {
			MenuItem menuItem = (MenuItem) iterator.next();
			System.out.println(menuItem.toString());
		}
	}
}
